********************************************************************************
* DURABLES
********************************************************************************
clear
clear matrix
set more off
set scheme s1color
estimates clear
graph drop _all
set matsize 2500
log close _all

* Set Directory
cd "../Do"

********************************************************************************
** LOAD AND CLEAN DATA
********************************************************************************

use ../Data/matched_data_durables_jun2018_baseline.dta, clear

** Labelling the 3 different durables spending variables; all are composites; 
** One is nominal; another is "real" deflated using a single (appliances) cpi; 
** Another is "real" deflated on a good-by-good basis (in previous merge file)
la var durables "nominal durable goods spending"
la var durables_real1 "real durable goods spending, single deflator"
la var durables_real2 "real durable goods spending, separate deflators"

drop ethnicity
** Recode Vars
recode mort (5=0)
recode stocks (5=0)
recode retacct (5=0)
recode howner (5=0)

* Recode some expectations variables from the Inflation surveys. 
* unemployment dummies
recode q6 (1=1) (2 3 = 0), gen(unemp_increase)
recode q6 (3=1) (1 2 = 0), gen(unemp_decrease)

gen conditions_12m = q2a
* note everybody who says "other" is in separate category
recode q2a (1=1) (2 3 = 0), gen(conditions_12m_better)
recode q2a (2=1) (1 3 = 0), gen(conditions_12m_worse)

gen interestrate_12m = q7
recode interestrate_12m (1=1) (2 3 = 0), gen(intrate_12m_up)
recode interestrate_12m (3=1) (1 2 = 0), gen(intrate_12m_down)

gen bconditions_12m = q4
* note everybody who says "other" is in separate category
recode q4 (1=1) (2 3 = 0), gen(bconditions_12m_better)
recode q4 (2=1) (1 3 = 0), gen(bconditions_12m_worse)

** House Price Forecasts
gen hppoint = .
replace hppoint = 0 if q41==3
replace hppoint = q42 if q41==1
replace hppoint = -q42 if q41==2
** Note: There are some extreme outliers (in the tens of thousands)
replace hppoint = . if abs(hppoint)>=200
la var hppoint "House price expectation"

** Prepare some additional descriptives
** Race isn't reported in all periods. 
preserve
collapse (mean) race , by(prim_key)
sort prim_key
tempfile race
save `race'
restore

drop race
sort prim_key
merge m:1 prim_key using `race'
tab _merge
drop _merge
drop if prim_key==""

recode race (1=1) (nonmissing = 0), gen(white)
gen nonwhite = 1-white
recode gender (2=1) (1=0), gen(female)
recode highesteducation (4 9 = 0) (10/16 = 1), gen(coll)

** q31s* gives codes. Kind of odd that they've created separate variables. 
*MB: odd to generate employed variable, because everyone in sample is employed--however some also say they are retired (?) 
gen employed = . 
replace employed=1 if q31s1==1
replace employed = 0 if (q31s2==2 | q31s3==3 | q31s4==4 | q31s5==5 | q31s6==6 | q31s7==7) & q31s1!=1

** Generate currently retired variable.
** Odd that some are retired even though all are employed; 
** How do retired people have wage growth expectations? they may be working a small job anyway
drop retired 
gen retired = . 
replace retired = 1 if q31s5==5
replace retired = 0 if (q31s1==1 | q31s2==2 | q31s3==3 | q31s4==4 | q31s6==6 | q31s7==7) & q31s5!=5
tab retired

** Below also added December 2019 from Arman's old code
gen gas_expect = . 
replace gas_expect = 0 if q47a==3
replace gas_expect = q47a_higher if q47a==1
replace gas_expect = -q47a_lower if q47a==2

local expectations "intrate_12m_up intrate_12m_down unemp_increase unemp_decrease rw_expect d_wageiqr hppoint"
local infl1 "d_inflmedian d_infliqr"
local infl2 "d_longinflmedian d_longinfliqr"

** When using lagss--may need to rename lagged vars or these locals to match
*local lags1 "lagE_d_inflmedian lagE_d_infliqr" ;
*local lags2 "lagE_d_longinflmedian lagE_d_longinfliqr" ;
local spec1 "Short-Run Infl. Exp."
local spec2 "Medium-Run Infl. Exp."
la var d_inflmedian "Inflation Expectations"
la var d_infliqr "Inflation Uncertainty"

*MB resume: add "howner_fix" code ?
*replace howner=0 if howner==.
*adds ten people to homeowner status; there are still some with howner_fix==0 who have positive mortgage payment, but missing data for has mortgage and/or mortgage amount
*two observations have howner==0 and mort==1 (say they're not a homeowner but they say they have a mortgage); not important so not recoding them for now

drop if mort==0 & amtmort!=. & amtmort>100
*fixing the mort indicator to impute plausible values for people based on other information
replace mort = 0 if (howner!=1 | mortgage==0) & mort==.
replace mort = 1 if (howner==1 | (mortgage>0 & mortgage!=.)) & mort==.

** Notice that amtmort may contradict mort dummy: one case such that mort=0 and 
** amtmort if positive; one has mort==0 and amtmort==0; these are consistent but 
** you might expect amtmort to be missing.

** There are 44 cases of those with mortgages for whom mortgage balance is missing--so I will just drop these observations from the sample
** The mortgage dummy is non-missing for over 2000 observations; however the mortgage balance (amtmort) is observed only for 990 people
*tab mort
la var mort "Has Mortgage"

** MB: generating quasi-continuous income variable based on midpoint of ranges of annual household income variables (familyincome and familyincome_part2)
rename familyincome inc2
rename familyincome_part2 inc2_2
drop if inc2==.
** Income variable: "new_faminc"
gen new_faminc=.
replace new_faminc=2500 if inc2==1
replace new_faminc=6250 if inc2==2
replace new_faminc=8750 if inc2==3
replace new_faminc=11250 if inc2==4
replace new_faminc=13750 if inc2==5
replace new_faminc=17500 if inc2==6
replace new_faminc=22500 if inc2==7
replace new_faminc=27500 if inc2==8
replace new_faminc=32500 if inc2==9
replace new_faminc=37500 if inc2==10
replace new_faminc=45000 if inc2==11
replace new_faminc=55000 if inc2==12
replace new_faminc=67500 if inc2==13
replace new_faminc=87500 if inc2==14 & (inc2_2==1 | inc2_2==.)
*above accounts for one person with inc2==14 and inc2_2 missing; 
*not sure why that's the case but I asigned them the lowest category of income over $75000
replace new_faminc=112500 if inc2==14 & inc2_2==2
replace new_faminc=162500 if inc2==14 & inc2_2==3
replace new_faminc=237500 if inc2==14 & inc2_2==4

gen log_new_faminc=log(new_faminc)

sort prim_key quarter
** Merge with SAMPLE WEIGHTS to quarterly data: 
** Warning, we might lose observations if the set requiring weights has changed; 
** This will affect our ability to run regs using non-employed types (can only do unweighted) 
merge m:1 prim_key using ../Data/qweights_pooled
** These are the reg weights, the full sample weights will still be called weight_full
** Weight variable is called "weight_samp" to indicate the weights were designed for the regression sample
*134 observations dropped that didn't merge with a weight_samp
drop if _merge!=3
drop _merge

** Define regression sample before recentering any variables: dropping extreme values
** Below should drop top 2 highest values of durables spending; I doubt it makes any difference 
drop if durables>20000  | durables_real1>20000 | durables_real2>20000
drop if prim_key=="5041140:1"
drop if mortgage>200000 & mortgage!=.
drop if d_inflmedian>35
drop if d_longinflmedian>35
drop if hppoint<-50
** End of optional restrictions 

** Locals for weights (can turn on or off in regression)
local weights "[pweight=weight_samp]"
local weights_full "[pweight=weight_full]"
local pwfile "_pw"

** Label Variables 
la var d_inflmedian "Inflation Expectation"
la var d_infliqr "Inflation Uncertainty"
la var d_longinflmedian "Inflation Expectation"
la var d_longinfliqr "Inflation Uncertainty"
la var lag_IE "Lagged Inflation Expectation"
la var lag_infl_iqr "Lagged Infl. Uncertainty"
la var hppoint "House price expectation"
la var gas_expect "Gas price expectation"

** Variable for sum of monthly payments--interactions between this variable and IE may be included in some models
gen payments=mortgage+car if howner==1
replace payments=rent+car if howner!=1
gen double log_payments=.
replace log_payments=log(payments) if payments>0
replace log_payments=0 if payments==0

** Dropping missing - Defining Sample
** Although this step isn't necessary, as they'll be dropped automatically in 
** regression.

*drop any observations with extreme value for payments (110,000): only if running a regression interacting with payments: actually none dropped here (unlike nondurables)
drop if payments>100000

drop if weight_samp==.
drop if d_inflmedian==.
drop if d_infliqr==.
drop if durables==.
** Dropping lagged IE: only need if we include lag IE in regression 
drop if lag_IE==.
drop if lag_infl_iqr==.
** New income variable: new_faminc is recode of categorical variables 
** familyincome and familyincome_part2; former variable was earnings last month and highly unreliable
drop if new_faminc==.
drop if intrate_12m_up==.
drop if intrate_12m_down==.
drop if unemp_increase==.
drop if unemp_decrease==.
drop if rw_expect==.
drop if d_wageiqr==.
drop if rage==.
drop if nonwhite==.
drop if female==.
drop if coll==.
drop if retired==.
drop if mort==.
** Below results in loss of 300+ observations--results are robust not imposing this restriction and omitting hppoint from regressions
drop if hppoint==.
** Below drops 111 observations--robustness applies again 
drop if howner==.

** Replacing relevant variables (and lags) with centered version.
** Note that means are not weighted; this doesn't matter because weighted mean is within 0.04 ppts of unweighted mean IE
egen IE_sampmean=mean(d_inflmedian) 
replace d_inflmedian=d_inflmedian-IE_sampmean
egen lag_IE_sampmean=mean(lag_IE)
replace lag_IE=lag_IE-lag_IE_sampmean
egen lag_unc_sampmean=mean(lag_infl_iqr)
replace lag_infl_iqr=lag_infl_iqr-lag_unc_sampmean
egen log_payments_sampmean=mean(log_payments)
replace log_payments=log_payments-log_payments_sampmean
egen log_inc_sampmean=mean(log_new_faminc)
replace log_new_faminc=log_new_faminc-log_inc_sampmean

sort prim_key quarter

** XTSET data because this is a panel
destring prim_key, generate(id_new) ignore(":")
xtset id_new quarter

** Generate within-person means of time-varying independent variables: 
** Note that for variables that were recentered above, these now represent the within-household average of the deviation from the sample mean for the given variable
egen IE_bar=mean(d_inflmedian), by(id_new)
egen IE_unc_bar=mean(d_infliqr), by(id_new)
egen new_faminc_bar=mean(new_faminc), by(id_new)
egen log_new_faminc_bar=mean(log_new_faminc), by(id_new)
egen intrate_up_bar=mean(intrate_12m_up), by(id_new)
egen intrate_down_bar=mean(intrate_12m_down), by(id_new)
egen unemp_up_bar=mean(unemp_increase), by(id_new)
egen unemp_down_bar=mean(unemp_decrease), by(id_new)
egen rw_bar=mean(rw_expect), by(id_new)
egen rw_unc_bar=mean(d_wageiqr), by(id_new)
*egen hp_bar=mean(hppoint), by(id_new)
*egen howner_bar=mean(howner), by(id_new)
egen mort_bar=mean(mort), by(id_new)
egen log_payments_bar=mean(log_payments), by(id_new)
egen hp_bar=mean(hppoint), by(id_new)
egen howner_bar=mean(howner), by(id_new)

** Within-person mean of lagged IE and lagged infl uncertainty are not needed--they are collinear with within-person mean of current IE and uncertainty
** Generate total durables spending within household
egen tot_durables=total(durables), by(id_new)
sum tot_durables, d

// gen double log_payments2 = .
// replace log_payments2 = log(payments/3) if payments > 0
// replace log_payments2 = 0 if payments == 0
// egen log_payments2_sampmean=mean(log_payments2)
// replace log_payments2=log_payments2-log_payments2_sampmean
//
// gen double log_payments_ch=.
// replace log_payments_ch=log(payments) if payments>0
// replace log_payments_ch=0 if payments==0
// egen log_payments_ch_sampmean=mean(log_payments_ch)
// replace log_payments_ch=log_payments_ch-log_payments_ch_sampmean

** Below drops 142 observations associated with households who never purchased durables under period of observation (reported zero spending on durables) 
drop if tot_durables==0
** Generate variable that equals 1 in all cases, to sum to determine observations per person
gen pre_obs=1
** Generate sum of observations per person
egen obs2=total(pre_obs), by(id_new)
sum obs2, d
** Restrict on having nonzero durables spending in at least one period (based on total durables spending within household) 
** Define sample  based on sufficient observation
gen durables_sample_hp=(obs2>=3)

count if durables_sample_hp==1
*MB temporary code to generate average observations per household
preserve 
keep if durables_sample_hp==1
collapse (mean) obs2 , by(id_new)
list
sum obs2, d
restore

** Reverse College
gen nocoll = 1-coll

** Reverse Mortgage
gen nomort = 1-mort
gen nomort_bar = 1-mort_bar

*log_payments_bar unemp_up_bar unemp_down_bar intrate_up_bar intrate_down_bar rw_bar hp_bar howner_bar mort_bar

********************************************************************************
** REGRESSIONS 
********************************************************************************

** Label variables for tables
la var log_new_faminc "Household Income (Log)"
la var log_payments "Monthly Payments (Log)"
la var intrate_12m_up "Int Rates Inc"
la var intrate_12m_down "Int Rates Dec"
la var rw_expect "Real Wage Expectation"
la var d_wageiqr "Wage Uncertainty"
la var nomort "No Mortgage"
la var rage "Age" 
la var nonwhite "Non-White"
la var female "Female"
la var retired "Retired"
la var howner "Homeowner"
la var hppoint "House Price Expectation"
la var unemp_increase "Unemp Inc"
la var unemp_decrease "Unemp Dec"

la var IE_bar "Mean Inflation Expectation"
la var IE_unc_bar "Mean Inflation Uncertainty"
la var log_new_faminc_bar "Mean Log Household Income"
la var log_payments_bar "Mean Log Monthly Payments"
la var intrate_up_bar "Mean Expects Interest Rate Increase" 
la var intrate_down_bar "Mean Expects Interest Rate Decrease"
la var rw_bar "Mean Real Wage Expectation"
la var rw_unc_bar "Mean Wage Uncertainty"
la var nomort_bar "Mean No Mortgage Indicator"
la var howner_bar "Mean Homeowner"
la var hp_bar "Mean House Price Expectation"
la var unemp_up_bar "Mean Expects Unemployment Increase"
la var unemp_down_bar "Mean Expects Unemployment Decrease"

la var nocoll "No College"

local durablesv "Nom. Durable Spending"
local durables_real1v "Real Durable Spending, Single Deflator"
local durables_real2v "Real Durable Spending, Separate Deflator"

foreach dur in durables_real2  { //durables durables_real1 durables_real2 durables

eststo clear
** Column 1: Basic Regression (no CRE, minimal RHS vars) 
#delimit ;
eststo x1: xtgee `dur' d_inflmedian d_infliqr 
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
estadd local cre "No"

** Column 2
#delimit ;
eststo x2: xtgee `dur' c.d_inflmedian c.d_infliqr 
log_new_faminc log_payments 
i.intrate_12m_up i.intrate_12m_down   
rw_expect d_wageiqr 
i.nomort rage i.nonwhite i.female i.retired 
i.howner hppoint
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
estadd local cre "No"

** Column 3
#delimit ;
eststo x3: xtgee `dur' d_inflmedian d_infliqr 
log_new_faminc log_payments 
i.intrate_12m_up i.intrate_12m_down   
rw_expect d_wageiqr  
i.nomort rage i.nonwhite i.female i.retired 
i.howner hppoint
i.unemp_increase i.unemp_decrease
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
estadd local cre "No"

** Column 4
#delimit ;
eststo x4: xtgee `dur' d_inflmedian d_infliqr 
log_new_faminc log_payments  
i.intrate_12m_up i.intrate_12m_down  
rw_expect d_wageiqr 
i.nomort rage i.nonwhite i.female i.retired 
i.howner hppoint
i.unemp_increase i.unemp_decrease 
IE_bar IE_unc_bar 
log_new_faminc_bar log_payments_bar
intrate_up_bar intrate_down_bar 
rw_bar rw_unc_bar nomort_bar 
howner_bar hp_bar 
unemp_up_bar unemp_down_bar   
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
estadd local cre "Yes"

** Column 5
#delimit ;
eststo x5: xtgee `dur' c.d_inflmedian##i.nocoll c.d_infliqr##i.nocoll 
log_new_faminc log_payments  
i.intrate_12m_up i.intrate_12m_down  
rw_expect d_wageiqr   
i.nomort rage i.nonwhite i.female i.retired 
i.howner hppoint
i.unemp_increase i.unemp_decrease 
IE_bar IE_unc_bar 
log_new_faminc_bar log_payments_bar 
intrate_up_bar intrate_down_bar 
rw_bar rw_unc_bar nomort_bar  
howner_bar hp_bar 
unemp_up_bar unemp_down_bar 
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
estadd local cre "Yes"

** Column 6
#delimit ;
eststo x6: xtgee `dur' c.d_inflmedian##i.nocoll c.d_infliqr##i.nocoll 
c.d_inflmedian##c.log_new_faminc_bar c.d_inflmedian##c.log_payments_bar c.d_inflmedian##c.nomort_bar 
log_new_faminc log_payments 
i.intrate_12m_up i.intrate_12m_down  
rw_expect d_wageiqr   
i.nomort rage i.nonwhite i.female i.retired 
i.howner hppoint
i.unemp_increase i.unemp_decrease 
IE_bar IE_unc_bar 
log_new_faminc_bar log_payments_bar 
intrate_up_bar intrate_down_bar 
rw_bar rw_unc_bar nomort_bar  
howner_bar hp_bar 
unemp_up_bar unemp_down_bar 
i.quarter [pweight=weight_samp] if durables_sample_hp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
lincom _b[d_inflmedian] + _b[1.nocoll#d_inflmedian]	
estadd local cre "Yes"

**Column 7
** MORTGAGE SUBSAMPLE
** Running regression models with only mortgage holders.
preserve
keep if mort==1
drop if mort==1 & amtmort==. 
drop if howner==0 //Doesn't make sense that some people aren't homeowners AND have a mortgage...
** Log of mortgage balance 
gen log_amtmort = log(amtmort) if amtmort>0
replace log_amtmort=0 if amtmort==0

** Replacing log_mortgage amount with centered version
egen log_amtmort_sampmean=mean(log_amtmort)
replace log_amtmort=log_amtmort-log_amtmort_sampmean
** Generate within-household average log mortgage balance
egen log_amtmort_bar=mean(log_amtmort), by(id_new)
** Generate variable that equals 1 in all cases, to sum to determine observations per person
gen pre_obs3=1
** Generate sum of observations per person
egen obs4=total(pre_obs3), by(id_new)
sum obs4, d

** Define sample  based on sufficient observation
gen mort_samp=(obs4>=3)

** Label
la var log_amtmort_bar "Mean Log Mortgage Balance"
la var log_amtmort "Mortgage Balance (Log)"

#delimit ; 
eststo x7: xtgee `dur' c.d_inflmedian##i.nocoll c.d_infliqr##i.nocoll 
c.d_inflmedian##c.log_amtmort_bar c.d_inflmedian##c.log_new_faminc_bar c.d_inflmedian##c.log_payments_bar   
log_amtmort log_new_faminc log_payments 
i.intrate_12m_up i.intrate_12m_down 
rw_expect d_wageiqr 
rage i.nonwhite i.female i.retired hppoint
i.unemp_increase i.unemp_decrease
IE_bar IE_unc_bar 
log_amtmort_bar log_new_faminc_bar log_payments_bar 
intrate_up_bar intrate_down_bar
rw_bar rw_unc_bar hp_bar
unemp_up_bar unemp_down_bar 
i.quarter [pweight=weight_samp] if mort_samp==1, 
family(poisson) link(log) corr(exch) vce(robust);
#delimit cr
lincom _b[d_inflmedian] + _b[1.nocoll#d_inflmedian]
estadd local cre "Yes"

** Export Table - Baseline
esttab x1 x2 x3 x4 x5 x6 x7 using "../Tables/`dur'var_tabs.tex", replace ///
label style(tex) star(* 0.10 ** 0.05 *** 0.01) b(%5.3f) se(%5.3f) booktabs longtable ///
stats(cre chi2 p N, labels("Correlated Random Effects" "Chi$^2$" "P Value" "Sample Size") fmt(%5s %5.2fc %5.2fc %7.0g )) varwidth(45) varlabels(_cons Constant) ///
title("Real Durable Goods Spending vs. Year-Ahead Expectations, Baseline Sample (Columns 1-6), Mortgagor Sample (Column 7), GEE estimation") ///
/*indicate("Correlated Random Effects = IE_unc_bar") drop( _cons rage 1.nonwhite 1.female 1.retired *quarter* log_payments_bar unemp_up_bar unemp_down_bar intrate_up_bar intrate_down_bar rw_bar hp_bar howner_bar nomort_bar hppoint log_payments)*/ ///
drop(*quarter* log_payments 1.intrate_12m_up 1.intrate_12m_down rw_expect d_wageiqr 1.nomort rage 1.nonwhite 1.female 1.retired 1.howner hppoint IE_unc_bar log_payments_bar intrate_up_bar intrate_down_bar rw_bar rw_unc_bar nomort_bar howner_bar hp_bar c.d_inflmedian#c.log_payments_bar c.d_inflmedian#c.nomort_bar _cons) ///
numbers msign(--) eqlabels(none) noconstant ///
nomtitles nobaselevels noomitted nonotes substitute( ///
"\bottomrule" "\bottomrule `=char(13)'\caption*{\normalsize \doublespacing Standard errors in parentheses. \\ `char(13)'\textit{Note:} Each column includes time fixed effects. All means refer to within-subject means. Model (1) includes the inflation expectation and inflation uncertainty. Model (2) adds household income (log), monthly payments (log), the \`\`expects interest rate increase'' indicator, the \`\`expects interest rate decrease indicator'', the real wage expectation, wage uncertainty, the house price expectation, the no mortgage indicator, respondent's age, and the indicators for non-white, female, retired, and homeowner. Model (3) adds the \`\`expects unemployment increase'' indicator and the \`\`expects unemployment decrease'' indicator. Model (4) adds the within-subject means of the inflation expectation, inflation uncertainty, household income (log), monthly payments (log), expects interest rate increase, expects interest rate decrease, the real wage expectation, wage uncertainty, the house price expectation, expects unemployment increase, expects unemployment decrease, the no mortgage indicator, and the homeowner indicator. Model (5) adds the no college indicator and the indicator’s interactions with the inflation expectation and inflation uncertainty. Model (6) adds interactions between the inflation expectation and each of within-subject mean household income (log), mean monthly payments (log), and the mean no mortgage indicator. Model (7) is restricted to the mortgagor sample. This model includes the mortgage balance (log), the within-subject mean of the mortgage balance (log), and the interaction between the inflation expectation and within-subject mean mortgage balance. The full set of coefficients is presented in Appendix H. Robust standard errors are clustered at the level of the individual respondent. \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)} \\" ///
"No College=1" "No College" ///
"Unemp Inc=1" "Expects Unemployment Increase" ///
"Unemp Dec=1" "Expects Unemployment Decrease" ///
"Int Rates Inc=1" "Expects Interest Rate Increase" ///
"Int Rates Dec=1" "Expects Interest Rate Decrease" ///
"No Mortgage=1" "No Mortgage Indicator" ///
"Non-White=1" "Non-White" ///
"Female=1" "Female" ///
"Retired=1" "Retired" ///
"Homeowner=1" "Homeowner" ///
"Inflation Expectation $\times$ Mean No Mortgage Indicator" "Mean No Mortgage Indicator $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Monthly Payments" "Mean Log Monthly Payments $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Household Income" "Mean Log Household Income $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Mortgage Balance" "Mean Log Mortgage Balance $\times$ Inflation Expectation" ///
)

esttab x1 x2 x3 x4 x5 x6 x7 using "../Tables/`dur'var_tabs_full.tex", replace ///
label style(tex) star(* 0.10 ** 0.05 *** 0.01) b(%5.3f) se(%5.3f) booktabs longtable ///
stats(cre chi2 p N, labels("Correlated Random Effects" "Chi$^2$" "P Value" "Sample Size") fmt(%5s %5.2fc %5.2fc %7.0g )) varwidth(45) varlabels(_cons Constant) ///
title("Table A11: Full Specification for Table 2, Real Durable Goods Spending vs. Year-Ahead Expectations, Baseline Sample (Columns 1-6), Mortgagor Sample (Column 7), GEE estimation") ///
/*indicate("Correlated Random Effects = IE_unc_bar") drop( _cons rage 1.nonwhite 1.female 1.retired *quarter* log_payments_bar unemp_up_bar unemp_down_bar intrate_up_bar intrate_down_bar rw_bar hp_bar howner_bar nomort_bar hppoint log_payments)*/ ///
drop(*quarter*) ///
numbers msign(--) eqlabels(none) noconstant ///
nomtitles nonotes nobaselevels noomitted substitute( ///
"\bottomrule" "\bottomrule `=char(13)'\caption*{\normalsize \doublespacing Standard errors in parentheses. \\ `char(13)'\textit{Note:} Each column includes time fixed effects. All means refer to within-subject means. Robust standard errors are clustered at the level of the individual. \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}" ///
"No College=1" "No College" ///
"Unemp Inc=1" "Expects Unemployment Increase" ///
"Unemp Dec=1" "Expects Unemployment Decrease" ///
"Int Rates Inc=1" "Expects Interest Rate Increase" ///
"Int Rates Dec=1" "Expects Interest Rate Decrease" ///
"No Mortgage=1" "No Mortgage Indicator" ///
"Non-White=1" "Non-White" ///
"Female=1" "Female" ///
"Retired=1" "Retired" ///
"Homeowner=1" "Homeowner" ///
"Inflation Expectation $\times$ Mean No Mortgage Indicator" "Mean No Mortgage Indicator $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Monthly Payments" "Mean Log Monthly Payments $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Household Income" "Mean Log Household Income $\times$ Inflation Expectation" ///
"Inflation Expectation $\times$ Mean Log Mortgage Balance" "Mean Log Mortgage Balance $\times$ Inflation Expectation" ///
"\caption{" "\caption*{" ///
)
}
